/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package reportcenter.auth;

import java.sql.Connection;
import java.sql.SQLException;
import org.springframework.jdbc.datasource.AbstractDataSource;
import reportcenter.support.dbutil.ConnectionManager;
import reportcenter.support.resourceload.DataSourceConfig;

/**luz
 *
 * @author renan da 
 */
public class CustomDataSource extends AbstractDataSource {

    public Connection getConnection() throws SQLException {
        Connection conn = null;
        new ConnectionManager(new DataSourceConfig("javadbteste"));
//        new ConnectionManager(new DataSourceConfig("javadb"));
        try {
            conn = ConnectionManager.ds.getConnection();
            ConnectionManager.printDriverStats();
            
        } catch (Exception e) {
            e.printStackTrace();
        } 
        return conn;
    }

    public Connection getConnection(String username, String password) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
